<?php
require_once(SITE_ROOT . 'class/db/DB.class.php');
require_once(SITE_ROOT . 'class/bean/TrainingType.class.php');

class DBTrainingType {
	
	public function getTrainingTypes() {
		$db = new DB();
		$connection = $db->connect();
		
		$trainingtypes = new ArrayObject();
				
		$select = "SELECT `trainingtype#`, `abbreviation`, `description_en` FROM `ttrainingtype` ";
		if ($stmt = $connection->prepare($select)) {
			$stmt->execute();
			
			$stmt->bindColumn(1, $trainingtypeID);
			$stmt->bindColumn(2, $abbreviation);
			$stmt->bindColumn(3, $description);
			
			while ($stmt->fetch()) {
				$trainingtype = new TrainingType($trainingtypeID, $abbreviation, $description);
				$trainingtypes->append($trainingtype);
			}
		}
		return $trainingtypes;
	}
		
}

?>